package com.jiuyue.movehouse.entity;

import java.math.BigDecimal;

import com.baomidou.mybatisplus.annotation.*;

import java.util.Date;
import java.io.Serializable;
import java.util.List;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;

/**
 * <p>
 * 
 * </p>
 *
 * @author yourFather
 * @since 2022-02-11
 */
@TableName("t_order")
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class Order implements Serializable {

    private static final long serialVersionUID = 1L;

      @TableId(value = "id", type = IdType.AUTO)
      @Null(groups = {Reservation.class})
    private Long id;

    /**
     * 出发点
     */
    @NotEmpty(message = "出发点不能为空",groups = {Reservation.class})
    private String startPlace;

    /**
     * 终点
     */
    @NotEmpty(message = "终点不能为空",groups = {Reservation.class})
    private String endPlace;

    /**
     * 距离
     */
    @NotNull(message = "距离不能为空",groups = {Reservation.class})
    private BigDecimal distance;


    @NotNull(message = "车辆类型不能为空",groups = {Reservation.class})
    @TableField(exist = false)
    private String carTypeId;

    /**
     * 车辆类型信息
     */
    private String carTypeName;

    /**
     * 搬家时间
     */
    @NotNull(message = "搬家时间不能为空",groups = {Reservation.class})
    private Date moveTime;

    @TableField(exist = false)
    private List<Long> extInfoIds;

    /**
     * 附加情况
     */
    private String extInfo;

    /**
     * 接单车牌
     */
    private String carNumber;

    /**
     * 备注
     */
    private String remark;

    /**
     * 总价
     */
    @NotNull(message = "总价不能为空",groups = {Reservation.class})
    private BigDecimal price;

    private BigDecimal realPrice;

    /**
     * 1:下单 2:取消 3:接单 4:配送完成 5: 支付完成
     */
    private Integer state;

    @TableField(exist = false)
    private String stateName;

    private Date receiveTime;

    private Date completeTime;

    private Date payTime;

    /**
     * 逻辑删除
     */
    @TableLogic
    private Long deleted;

    /**
     * 更新时间
     */
    @TableField(updateStrategy = FieldStrategy.NEVER)
    private Date updateTime;

    /**
     * 创建时间
     */
    @TableField(updateStrategy = FieldStrategy.NEVER)
    private Date createTime;

    /**
     * 用户id
     */
    @NotNull(message = "用户id不能为空",groups = {Reservation.class})
    private Long userId;

    private String username;

    @TableField(exist = false)
    private String phone;

    public @interface Reservation{}


}
